

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body layadmin-themealias="default">

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body" pad15="">

                    <div class="layui-form" wid100="" lay-filter="">
                        <input type="hidden" name="id" value="{$giftinfo.id}">
                        <div class="layui-form-item">
                            <label class="layui-form-label">排序</label>
                            <div class="layui-input-block">
                                <input type="text" name="sort" value="{$giftinfo.sort}" class="layui-input" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" value="{$giftinfo.title}" class="layui-input" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">图标</label>
                            <div class="layui-input-inline">
                                <input name="icon" lay-verify="required" id="LAY_iconImgSrc" placeholder="图片地址" value="{$giftinfo.icon}" class="layui-input">
                            </div>
                            <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                <button type="button" class="layui-btn layui-btn-primary" id="LAY_iconImgUpload">
                                    <i class="layui-icon">&#xe67c;</i>上传图片
                                </button>
                                <button class="layui-btn layui-btn-primary" layadmin-event="coverImgPreview">查看图片</button >
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">动画</label>
                            <div class="layui-input-inline">
                                <input name="animation" lay-verify="required" id="LAY_animationSrc" placeholder="动画地址" value="{$giftinfo.animation}" class="layui-input">
                            </div>
                            <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                <button type="button" class="layui-btn layui-btn-primary" id="LAY_animationUpload">
                                    <i class="layui-icon">&#xe67c;</i>上传动画
                                </button>
                                <button class="layui-btn layui-btn-primary" layadmin-event="animationPreview">查看动画</button >
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">动画类型</label>
                            <div class="layui-input-inline">
                                <select name="animat_type" lay-verify="required">
                                    {if $giftinfo.animat_type == 0}
                                        <option value="0" selected>无</option>
                                        <option value="1">gif</option>
                                        <option value="2">svga</option>
                                    {elseif $giftinfo.animat_type == 1/}
                                        <option value="0">无</option>
                                        <option value="1" selected>gif</option>
                                        <option value="2">svga</option>
                                    {else /}
                                        <option value="0">无</option>
                                        <option value="1">gif</option>
                                        <option value="2" selected>svga</option>
                                    {/if}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">动画时长/ms</label>
                            <div class="layui-input-block">
                                <input type="text" name="duration" value="{$giftinfo.duration}" class="layui-input" lay-verify="required" placeholder="请填写整数，单位为毫秒">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">价格/金币</label>
                            <div class="layui-input-block">
                                <input type="text" name="price" value="{$giftinfo.price}" class="layui-input" lay-verify="required" placeholder="仅填写数字，单位金币/分钟">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">礼物类型</label>
                            <div class="layui-input-inline">
                                <select name="type" lay-verify="required">
                                    {if $giftinfo.type == 0}
                                    <option value="0" selected>普通礼物</option>
                                    <option value="1">豪华礼物</option>
                                    {elseif $giftinfo.type == 1/}
                                    <option value="0">普通礼物</option>
                                    <option value="1" selected>豪华礼物</option>
                                    {else /}
                                    <option value="0">普通礼物</option>
                                    <option value="1">豪华礼物</option>
                                    {/if}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">特殊类型</label>
                            <div class="layui-input-inline">
                                <select name="use_type" lay-verify="required">
                                    <option value="0" {if $giftinfo.use_type == 0}selected{/if}>无</option>
                                    <option value="1" {if $giftinfo.use_type == 1}selected{/if}>全频道</option>
                                    <option value="2" {if $giftinfo.use_type == 2}selected{/if}>守护专属</option>
                                    {/if}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block text-center">
                                <button class="layui-btn" lay-submit="" lay-filter="gift-edit">确认保存</button>
                                <button class="layui-btn layui-btn-primary" id="close">取消</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script src="/assets/cos-js-sdk-v5/cos-js-sdk-v5.min.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'gift', 'form', 'admin'], function() {
        var $ = layui.$
            ,form = layui.form
            ,admin = layui.admin;
        var index = parent.layer.getFrameIndex(window.name);

        $('#close').on("click",function () {
            parent.layer.close(index);
        });

        form.on('submit(gift-edit)', function(obj){
            //提交
            admin.req({
                url: '/admin/gift/edit_post'
                ,data: obj.field
                ,success: function(res){
                    if (res.code == 0){
                        parent.layer.close(index);
                        parent.layer.msg(res.msg, {icon: 1});
                        parent.layui.table.reload('LAY-gift-manage');
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>
